class CreateEquivalentGrades < ActiveRecord::Migration
  def self.up
    create_table :equivalent_grades do |t|
      t.references :grade
      t.integer :equivalent_to_id

      t.timestamps
    end

    add_index(:equivalent_grades, [:grade_id, :equivalent_to_id], :unique => true)
    add_index(:equivalent_grades, :grade_id, :unique => false)
  end

  def self.down
    remove_index(:equivalent_grades, :column => [:grade_id, :equivalent_to_id])
    remove_index(:equivalent_grades, :column => :grade_id)
    drop_table :equivalent_grades
  end
end
